package com.quartz.tasks.web.vo;

public enum SystemError {
	//系统全局错误码(00开头)
	SYSTEM_ERROR					("000001", "服务器内部错误，请稍后再试"),
	INVALID_PARAMS					("000002", "请求参数不合法"),
	DATA_VALIDATE_FAILD				("000003", "数据验证未通过"),
	SYSTEM_SQL_ERROR				("000004", "数据库操作异常"),
	SYSTEM_WEB_405					("000005", "不支持的请求方式"),
	SYSTEM_WEB_4XX					("000006", "请求的资源不存在或限制访问"),
	SYSTEM_WEB_5XX					("000007", "请求处理失败或服务不可用"),
	INVALID_PARAMS_TYPE				("000008", "请求参数数据类型不匹配"),
	UNKNOWN_EXCEPTION				("000009", "未知异常，请联系肖昌伟(changw.xiao@qq.com)增加相应处理"),
	REQUEST_METHOD_NOT_SUPPORTED	("000010", "不支持的请求方式"),
	MYBATIS_EXCEPTION				("000011", "数据查询或返回映射错误，请检查查询条件"),
	NULLPOINTER_EXCEPTION			("000012", "空指针异常，请检查业务逻辑"),
	MEDIATYPE_NOTSUPPORTED_EXCEPTION("000013", "不支持的请求类型"),
	DISTRIBUTED_BUSINESS_FAILD		("000013", "业务处理失败,请重试"),
	SYSTEM_WARD_STATUS_CODE			("000014","编码已存在"),

	//登录认证相关
	INVALID_USERNAME_OR_PASSWORD	("010001","登录信息错误"),
	INVALID_AUTH_INFO				("010001","错误的认证信息或登录超时，请重新登录"),
	
	INCOMPLETE_INFO					("010001","用户认证信息不完整"),
	ACCESS_DENIED					("010002","拒绝登录"),
	INVALID_PSWD					("010003","密码错误"),
	USER_NOT_EXIST					("010004","用户不存在"),
	ACCOUNT_LOCKED					("010005","账户已被锁定"),
	SSO_SERVICE_EX					("010006","登录服务异常"),
	INVALID_IPADDR					("010007","登录IP地址异常"),
	INVALID_STATE					("010008","状态异常"),
	KICKOUT_EX						("010009","账号在其它地方登录"),
	SERVICE_EXPIRE					("010010","服务已过期"),
	HTTP_REQUEST_FAILD				("010011","请求失败"),
	INVALID_PERMISSION				("010012","无权限"),
	ACCOUNT_STOP					("010013","账户已停用");

	private String code;

	private String message;

	private SystemError(String code, String message) {
		this.code = code;
		this.message = message;
	}

	public static SystemError getByCode(String code) {
		for (SystemError errorCode : SystemError.values()) {
			if (code.equals(errorCode.getCode())) {
				return errorCode;
			}
		}
		return null;
	}

	public String getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}

	public SystemError setMessage(String message) {
		this.message = message;
		return this;
	}

}
